Goodlabour.ru (main) Index TheGame

TheGame:
GameScenario - Пт 06 июн 2025
thegame_keydb_php - Пт 06 июн 2025
The game scene(godot) - Пт 06 июн 2025
autopub - Пт 06 июн 2025
Remove Duplicates - Пт 06 июн 2025 22:11:05 MSK
Status Auto Update - Сб 07 июн 2025 18:10:33 MSK
KeyDB Status Control - 07.06.2025 18:55
EngineeringApproachВт 10 июн 2025 10:09:40 MSK
Последние:
BooksNetworkSecurityВт 10 июн 2025 12:06:13 MSK
platformВс 15 июн 2025 23:50:39 MSK
PostgreqGuru-1Пт 20 июн 2025 11:08:56 MSK
ErusevParsedownReadmeПт 20 июн 2025 11:21:28 MSK
file_descriptorsПт 17 окт 2025 18:26:39 MSK

extends StaticBody3D

@onready var detection_area = $DetectionArea @onready var mesh = $MeshInstance3D

Настройки реакции

@export var highlight_color: Color = Color(1, 0.5, 0.5) @export var pulse_speed: float = 3.0 @export var selection_effect: PackedScene

var is_player_near: bool = false var is_being_looked_at: bool = false var default_material: StandardMaterial3D var current_tween: Tween

func _ready():

Сохраняем оригинальный материал

default_material = mesh.material_override.duplicate() mesh.material_override = default_material

Подключаем сигналы области обнаружения

detection_area.body_entered.connect(_on_body_entered) detection_area.body_exited.connect(_on_body_exited)

func _on_body_entered(body): if body.is_in_group("player"): is_player_near = true start_proximity_effect()

func _on_body_exited(body): if body.is_in_group("player"): is_player_near = false stop_proximity_effect()

func on_look_at(): is_being_looked_at = true start_look_effect() print(name, ": Player is looking at me!")

func on_look_away(): is_being_looked_at = false stop_look_effect() print(name, ": Player looked away")

func on_interact(): print(name, ": Player selected me!") apply_selection_effect()

Здесь можно добавить логику выбора

Пример: уведомление системы выбора

get_tree().call_group("choice_system", "object_selected", self)

func start_proximity_effect():

Легкая пульсация при приближении

if current_tween: current_tween.kill()

current_tween = create_tween().set_loops() current_tween.tween_property(mesh, "scale", Vector3(1.1, 1.1, 1.1), 1.0) current_tween.tween_property(mesh, "scale", Vector3.ONE, 1.0)

func stop_proximity_effect(): if current_tween: current_tween.kill() current_tween = null

Возвращаем нормальный размер

create_tween().tween_property(mesh, "scale", Vector3.ONE, 0.3)

func start_look_effect():

Подсветка при фокусировке

var highlight_mat = default_material.duplicate() highlight_mat.emission_enabled = true highlight_mat.emission = highlight_color highlight_mat.emission_energy_multiplier = 1.5

mesh.material_override = highlight_mat

Усиленная пульсация

if current_tween: current_tween.kill()

current_tween = create_tween().set_loops() current_tween.tween_property(mesh, "scale", Vector3(1.2, 1.2, 1.2), 0.5) current_tween.tween_property(mesh, "scale", Vector3(1.1, 1.1, 1.1), 0.5)

func stop_look_effect(): mesh.material_override = default_material stop_proximity_effect()

func apply_selection_effect():

Эффект при выборе (например, партиклы)

if selection_effect: var effect = selection_effect.instantiate() add_child(effect) effect.global_position = global_position effect.emitting = true